//
//  NextViewController.m
//  CIrcleChangeTransition
//
//  Created by Chenbo on 16/6/29.
//  Copyright © 2016年 北京数字天域科技有限公司. All rights reserved.
//

#import "NextViewController.h"
#import "CircleTransitioner.h"

@interface NextViewController ()<UIViewControllerTransitioningDelegate>

@end

@implementation NextViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor greenColor];
   _firstBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
    _firstBtn.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height - 50);
    [_firstBtn setBackgroundColor:[UIColor redColor]];
    _firstBtn.clipsToBounds = YES;
    _firstBtn.layer.cornerRadius = 50 / 2;
    [_firstBtn addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_firstBtn];
}
- (void) dismiss {
    self.transitioningDelegate = self;
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed{
    CircleTransitioner* transitioner = [[CircleTransitioner alloc] init];
    transitioner.presenting = NO;
    return transitioner;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
